/*
 * TrayActionListener.java
 * Copyright (C) 2007 Ezequiel Turovetzky
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 3
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, see <http://www.gnu.org/licenses/>.
 */
package ar.com.botonera.gui.systray;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JFrame;

import ar.com.botonera.Application;

/**
 * Implementa la acci&oacute;n a realizarse cuando se hace 
 * doble click sobre el &iacute;cono del &aacute;rea de notificaci&oacute;n.
 * <br>Si la ventana est&aacute; oculta, se la muestra.
 * <br>Si la ventana est&aacute; visible, se la esconde.
 * @author <a href="mailto:tezequiel@gmail.com">Ezequiel Turovetzky</a>
 * @version 1.0
 */
public class TrayActionListener implements ActionListener {


    //~ Constructors -----------------------------------------------------------

    /**
     * Crea una nueva instancia de esta clase.
     */
    public TrayActionListener() {
    }

    //~ Methods ----------------------------------------------------------------

    /**
     * Oculta o muestra la ventana, dependeniendo del estado
     * en que se encuentre en el momento.
     * <br>Si la ventana est&aacute; oculta, se la muestra.
     * <br>Si la ventana est&aacute; visible, se la esconde.
     */
    @Override
    public void actionPerformed(ActionEvent e) {
    	JFrame frame = Application.getInstance().getWindow();
        frame.setVisible(!frame.isVisible());
    }
}